import * as PIXI from 'pixi.js'
export default (textureSource: PIXI.TextureSource) => {
  // 等阶
  const rankArr: {
    name: string
    coord: Wx.Sprite.Coord
  }[] = [
    {
      name: 'sky', // 天
      coord: [865, 527, 125, 125],
    },
    {
      name: 'earth', //地
      coord: [1215, 697, 125, 125],
    },
    {
      name: 'ordinary', // 凡
      coord: [379, 321, 125, 125],
    },
  ]

  const container = new PIXI.Container()
  rankArr.forEach((item, index) => {
    const sprite = new PIXI.Sprite(
      new PIXI.Texture({
        source: textureSource,
        frame: new PIXI.Rectangle(...item.coord),
      }),
    )
    sprite.anchor.set(0.5)
    sprite.scale.set(0.6)
    sprite.position.set((-1 + index) * (309 / 2 - sprite.width * 0.3), 366 * 1.1 - sprite.height * 0.3)
    container.addChild(sprite)
  })
  return container
}
